Ternary 三元運算子


Posted by Rich on 2021-04-22

console.log(10 > 5 ? 'bigger' : 'smaller')
output:bigger

condition ? true : false
條件 ? true就執行 : false就執行


#note







Related Posts

webpack 新手教學之淺談模組化與 snowpack

webpack 新手教學之淺談模組化與 snowpack

Print a list from n times 1 to n times 9

Print a list from n times 1 to n times 9

【隨堂筆記】網路概論與Web網頁應用基礎

【隨堂筆記】網路概論與Web網頁應用基礎


Comments